﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CXedu.Business;
using System.Collections;
using CXedu.Model;
using System.ComponentModel;

namespace CXedu.WebSite.UC
{
    public partial class right : System.Web.UI.UserControl
    {
        Hashtable table = new Hashtable();
        protected IList<News> gonggaolist = new List<News>();
        protected IList<News> mingshiFClist = new List<News>();
        INewsBusiness newsBll = new NewsBusinessFactory().CreateNewsBusiness();

        protected void Page_Load(object sender, EventArgs e)
        {
            table.Add("TopNum", 6);
            table.Add(NewsHash.CId, 14);
            table.Add(NewsHash.OrderField, "InTime");
            table.Add(NewsHash.OrderDirection, "desc");
            gonggaolist = newsBll.GetAllNews(table);

            //资格证书的页面：右边栏：教育资讯
            if (CurrentNavType == CXedu.WebSite.NavigationType.List_7 || CurrentNavType == CXedu.WebSite.NavigationType.AdultEdu)
            {
                table.Clear();
                table.Add("TopNum", 14);
                table.Add(NewsHash.CId, 1);
                mingshiFClist = newsBll.GetAllNews(table);
            }
            //教育资讯的页面：右边栏政策法规
            else if (CurrentNavType == CXedu.WebSite.NavigationType.List_1)
            {
                table.Clear();
                table.Add("TopNum", 8);
                table.Add(NewsHash.CId, 9);
                mingshiFClist = newsBll.GetAllNews(table);
            }
            //关于我们、报名联系的页面：右边栏的名师风采都不要了
            else if (CurrentNavType != CXedu.WebSite.NavigationType.About || CurrentNavType != CXedu.WebSite.NavigationType.Contact)
            {
                table.Clear();
                table.Add("TopNum", 3);
                table.Add(NewsHash.CId, 20);
                mingshiFClist = newsBll.GetAllNews(table);
            }
        }

        private NavigationType _currentNavType;
        [Browsable(true), Description("")]
        public NavigationType CurrentNavType
        {
            get
            {
                return _currentNavType;
            }
            set
            {
                _currentNavType = value;
            }
        }

    }
}